const Vec2 = @import("vec2.zig");
const Rotation = @import("rotation.zig");

pub const Body = @This();

/// The body type: static, kinematic, or dynamic.
type: BodyType,
/// The initial world position of the body. Bodies should be created with the desired position.
position: Vec2,
///The initial world rotation of the body.
rotation: Rotation,
/// The initial linear velocity of the body's origin. Usually in meters per second.
linear_velocity: Vec2,
/// The initial angular velocity of the body. Radians per second.
angular_velocity: f32,
/// Linear damping is used to reduce the linear velocity.
linear_damping: f32,
/// Angular damping is used to reduce the angular velocity.
angular_damping: f32,
/// Scale the gravity applied to this body. Non-dimensional.
gravity_scale: f32,
/// Sleep speed threshold, default is 0.05 meters per second
sleep_threshold: f32,
name: []u8,
/// Set this flag to false if this body should never fall asleep.
enable_sleep: bool,
/// Is this body initially awake or sleeping
is_awake: bool,
/// Should this body be prevented from rotating? Useful for characters.
fixed_rotation: bool,
/// Treat this body as high speed object that performs continuous collision detection
/// against dynamic and kinematic bodies, but not other bullet bodies.
is_bullet: bool,
/// Used to disable a body. A disabled body does not move or collide.
is_enabled: bool,
/// This allows this body to bypass rotational speed limits. Should only be used
/// for circular objects, like wheels.
allowFastRotation: bool,
/// Used internally to detect a valid definition. DO NOT SET.
internalValue: u32,

/// The body simulation type.
/// Each body is one of these three types. The type determines how the body behaves in the simulation.
pub const BodyType = enum(u8) {
    StaticBody = 0, //zero mass, zero velocity, may be manually moved
    KinematicBody = 1, // zero mass, velocity set by user, moved by solver
    dynamicBody = 2, // positive mass, velocity determined by forces, moved by solver
};
